package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchPressureDropAnalysisResults;
import com.ruoyi.system.service.IDispatchPressureDropAnalysisResultsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 压降分析结果Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchPressureDropAnalysisResults")
public class DispatchPressureDropAnalysisResultsController extends BaseController
{
    @Autowired
    private IDispatchPressureDropAnalysisResultsService dispatchPressureDropAnalysisResultsService;

    /**
     * 查询压降分析结果列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureDropAnalysisResults:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchPressureDropAnalysisResults dispatchPressureDropAnalysisResults)
    {
        startPage();
        List<DispatchPressureDropAnalysisResults> list = dispatchPressureDropAnalysisResultsService.selectDispatchPressureDropAnalysisResultsList(dispatchPressureDropAnalysisResults);
        return getDataTable(list);
    }

    /**
     * 导出压降分析结果列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureDropAnalysisResults:export')")
    @Log(title = "压降分析结果", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchPressureDropAnalysisResults dispatchPressureDropAnalysisResults)
    {
        List<DispatchPressureDropAnalysisResults> list = dispatchPressureDropAnalysisResultsService.selectDispatchPressureDropAnalysisResultsList(dispatchPressureDropAnalysisResults);
        ExcelUtil<DispatchPressureDropAnalysisResults> util = new ExcelUtil<DispatchPressureDropAnalysisResults>(DispatchPressureDropAnalysisResults.class);
        util.exportExcel(response, list, "压降分析结果数据");
    }

    /**
     * 获取压降分析结果详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureDropAnalysisResults:query')")
    @GetMapping(value = "/{pressureDropAnalysisResultsId}")
    public AjaxResult getInfo(@PathVariable("pressureDropAnalysisResultsId") Long pressureDropAnalysisResultsId)
    {
        return success(dispatchPressureDropAnalysisResultsService.selectDispatchPressureDropAnalysisResultsByPressureDropAnalysisResultsId(pressureDropAnalysisResultsId));
    }

    /**
     * 新增压降分析结果
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureDropAnalysisResults:add')")
    @Log(title = "压降分析结果", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchPressureDropAnalysisResults dispatchPressureDropAnalysisResults)
    {
        return toAjax(dispatchPressureDropAnalysisResultsService.insertDispatchPressureDropAnalysisResults(dispatchPressureDropAnalysisResults));
    }

    /**
     * 修改压降分析结果
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureDropAnalysisResults:edit')")
    @Log(title = "压降分析结果", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchPressureDropAnalysisResults dispatchPressureDropAnalysisResults)
    {
        return toAjax(dispatchPressureDropAnalysisResultsService.updateDispatchPressureDropAnalysisResults(dispatchPressureDropAnalysisResults));
    }

    /**
     * 删除压降分析结果
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPressureDropAnalysisResults:remove')")
    @Log(title = "压降分析结果", businessType = BusinessType.DELETE)
	@DeleteMapping("/{pressureDropAnalysisResultsIds}")
    public AjaxResult remove(@PathVariable Long[] pressureDropAnalysisResultsIds)
    {
        return toAjax(dispatchPressureDropAnalysisResultsService.deleteDispatchPressureDropAnalysisResultsByPressureDropAnalysisResultsIds(pressureDropAnalysisResultsIds));
    }
}
